fn main() {
    let mut ex = IterV1{cur: 2, step: 3, max:11};
    loop {
        match ex.next(){
            Some(v) => println!("loop {}", v),
            None => break,
        }
    }
    println!("=====Goood to see=======");
    let mut ex = IterV1{cur: 2, step: 3, max:11};
    while let Some(v) = ex.next(){
        println!("while  {}", v);
    }
    println!("=====Goood to see=======");
    let  ex = IterV1{cur: 2, step: 3, max:11};
    for i in ex {
        println!("for in {}", i);
    }
}

pub struct IterV1 {
    cur: i32,
    step: i32,
    max: i32,
}

impl Iterator for IterV1 {
    type Item = i32;
    fn next(&mut self) -> Option<Self::Item> {
            if self.cur >= self.max {return None}
            let res = self.cur;
            self.cur += self.step;
            Some(res)
    }
}

